import Vue from 'vue'
import Vuex from 'vuex'

// import {
//     INCREMENT,
//     AUPDATEINFO
// } from './mutations-types'

import mutations from './mutations'
import actions from './actions'
import getters from './getters'
import moduleA from './modules/moduleA'

// 1.安装插件
Vue.use(Vuex)

// 2.创建对象
const store = new Vuex.Store({
    state: {
        // 存放数据
        counter: 1000,
        students: [{
                id: 1000,
                name: 'wayne',
                age: 18
            },
            {
                id: 1001,
                name: 'kobe',
                age: 24
            },
            {
                id: 1002,
                name: 'james',
                age: 15
            },
            {
                id: 1003,
                name: 'curry',
                age: 10
            }
        ],
        info: {
            name: 'kobe',
            age: 40,
            height: 1.98
        }
    },
    mutations,
    actions,
    getters,
    // 模块化store，解决臃肿
    modules: {
        // 模块会放到state中去
        moduleA
    }
})

// 3.导出store独享
export default store